﻿//--------------------------------------------------------------------------
// 
//  Copyright (c) Chili Software.  All rights reserved. 
// 
//  File: IQuery.cs
//
//  Description: Specifies the main methods and properties of a query.
// 
//--------------------------------------------------------------------------

using System;
using Chili.Opf3.Storages;

namespace Chili.Opf3.Query
{
	/// <summary>
	/// This interface is implemented by each type of Query. Classes
	/// that implement this interface can be used as queries in the framework.
	/// </summary>
	public interface IQuery
	{
		/// <summary>
		/// Converts the <see cref="IQuery">IQuery</see> to an
		/// <see cref="Opf3.Query.CompiledQuery">CompiledQuery</see> that is then executed on a
		/// specific <see cref="Opf3.Storages.IStorage">storage</see>.
		/// </summary>
		/// <returns>
		/// A new <see cref="CompiledQuery">CompiledQuery</see> that has been generated using this instance.
		/// </returns>
		/// <param name="storage">
		/// Class that implements the <see cref="Opf3.Storages.IStorage">IStorage</see>
		/// interface. The query is executed on that storage.
		/// </param>
		CompiledQuery ToCompiledQuery(IStorage storage);

		/// <summary>
		/// Specifies the wait time before terminating the attempt to execute a command and generating an error.
		/// </summary>
		/// <value>An integer that specifies the wait time in seconds.</value>
		int Timeout { get; set; }

		/// <summary>
		/// Returns the <see cref="Opf3.Query.QueryTypes">QueryType</see> of the query.
		/// </summary>
		/// <value>
		/// A member of the <see cref="Opf3.Query.QueryTypes">QueryType</see>
		/// enumeration.
		/// </value>
		QueryTypes QueryType { get; }
	}
}
